﻿<UserControl x:Class="LFSRecord2.View.TimelineStructures.TimelineAudioLayerInfoView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:lfsconv="clr-namespace:LFSRecord2.View.Converters"
             mc:Ignorable="d" Loaded="UserControl_Loaded"
             d:DesignHeight="17" d:DesignWidth="225"
             Width="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ItemsControl}}, Path=ActualWidth}">
    <UserControl.Resources>
        <lfsconv:LabelSelectionBackgroundBrushConverter x:Key="labelSelectionBackgroundBrushConverter" />
        <lfsconv:LabelSelectionForegroundBrushConverter x:Key="labelSelectionForegroundBrushConverter" />
        <lfsconv:LayerCollapseImageConverter x:Key="layerCollapseImageConverter" />
        <lfsconv:PropertyValueBrushConverter x:Key="propertyValueBrushConverter" />
        <lfsconv:AudioDataViewHeightConverter x:Key="audioDataViewHeightConverter" />
    </UserControl.Resources>
    <Grid Height="{Binding IsCollapsed, Converter={StaticResource audioDataViewHeightConverter}}" Background="#FF555555">
        <Image Name="CollapseImage" Margin="4,5,4,0" 
                Source="{Binding IsCollapsed, Converter={StaticResource layerCollapseImageConverter}}" 
                Stretch="None" 
                HorizontalAlignment="Left" 
                VerticalAlignment="Top"
                MouseLeftButtonDown="CollapseImage_MouseLeftButtonDown" />
        <StackPanel Name="LayerNameSelectionBackground" 
                    Width="160" Height="14"
                    Orientation="Horizontal"
                    Margin="15,1.5,0,0"
                    Background="{Binding IsSelected, Converter={StaticResource labelSelectionBackgroundBrushConverter}}"
                    HorizontalAlignment="Left"
                 VerticalAlignment="Top"
                    MouseLeftButtonDown="LayerNameLabel_MouseLeftButtonDown"
                    MouseRightButtonDown="LayerNameLabel_MouseLeftButtonDown">
            <TextBlock Name="LayerNameLabel" 
                    Margin="1,-1,0,0" Padding="0" 
                    Text="{Binding LayerName}" 
                    Foreground="{Binding IsSelected, Converter={StaticResource labelSelectionForegroundBrushConverter}}" 
                    FontWeight="Bold" FontStyle="Italic" 
                    HorizontalAlignment="Left" IsHitTestVisible="False" />
        </StackPanel>
        <TextBox Name="LayerRenameBox" 
                    Width="160" Height="17" 
                    Margin="15,1.5,0,0" Padding="0,-2,0,-1"
                    HorizontalAlignment="Left" 
                 VerticalAlignment="Top"
                    MaxLength="23"
                    Visibility="Collapsed" />

        <Border HorizontalAlignment="Right"
                VerticalAlignment="Top"
                Margin="0, 3, 5, 1"
                BorderBrush="{Binding IsMuted, Converter={StaticResource propertyValueBrushConverter}, ConverterParameter=Background}" 
                Background="#FF6A6A6A" 
                BorderThickness="1" 
                CornerRadius="3"
                MouseLeftButtonDown="Mute_MouseLeftButtonDown"
                UseLayoutRounding="True">
            <Label Name="ParentNameLabel" 
                    Padding="2,0,2,0" 
                    Margin="0,-2,0,0" 
                    HorizontalAlignment="Left" 
                    Foreground="{Binding IsMuted, Converter={StaticResource propertyValueBrushConverter}, ConverterParameter=Background}" 
                    FontSize="10" 
                    IsHitTestVisible="False">M</Label>
        </Border>
            
        <Line X1="0" X2="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=Width}"
              Y1="0.5" Y2="0.5"
              VerticalAlignment="Bottom"
              Stroke="#FF606060"
              StrokeThickness="1"
              IsHitTestVisible="False" />
    </Grid>
</UserControl>
